import { MESSAGE_DURATION } from "../constants";
export const showToast = (
  title: string,
  icon?: UniNamespace.ShowToastOptions["icon"],
  duration?: number,
  options?: UniNamespace.ShowToastOptions
) => {
  uni.showToast({
    title,
    icon: icon || "none",
    duration: duration ?? MESSAGE_DURATION,
    ...options,
  });
};

// 延时函数
export const sleep = (time: number) => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(true);
    }, time);
  });
};
